package com.jiayou.Map;

import com.jiayou.Tank.Tank1;
import com.jiayou.tools.TheGameLoading;

import java.awt.*;
import java.awt.Image;
import java.util.ArrayList;
import java.util.List;

public class Map {
    private static int num = 0;
    private  Image zhaun = TheGameLoading.getImage("zhuan.png");
    private  Image water = TheGameLoading.getImage("water1.png");
    private  Image gang = TheGameLoading.getImage("gang.png");
    private  Image bush = TheGameLoading.getImage("bush.png");
    public  int[][] map= new int[5][5];
    private List<Image> imageList = new ArrayList<>();
    public Map(){
        for (int a =0;a<5;a++)
        {
            for (int b = 0;b<5;b++)
            {
                map[a][b] =(int)(1+Math.random()*(4-1+1));
            }
        }
    }

    public  void draw(Graphics graphics, Tank1 tank1)
    {

           int width = 0;
           int heigh = 0;
                for (int c = 0;c<5;c++)
                {
                    heigh+=80;
                    for (int d=0;d<5;d++)
                    {
                        width+=80;
                        num++;
                        switch (map[c][d])
                        {
                            case 1:
                                graphics.drawImage(zhaun,width,heigh,40,40,null);
                                break;
                            case 2:
                                graphics.drawImage(water,width,heigh,40,40,null);
                                break;
                            case 3:
                                graphics.drawImage(gang,width,heigh,40,40,null);
                                break;
                            case 4:
                                graphics.drawImage(bush,width,heigh,40,40,null);
                                break;
                                default:break;
                        }
                    }
                }


        System.out.println("That is okay is:" +num);
    }


}
